package hunter20240524;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class IteratorTest<S> {
    public static void main(String[] args) {
        Collection<String> coll = new ArrayList<>();
        coll.add("aaa");
        coll.add("bbb");
        coll.add("ccc");

        //迭代器
//        Iterator<String> it = coll.iterator();
//        while (it.hasNext()) {
//            String str = it.next();
//            System.out.println(str);
//        }

        //增强for循环
        for (String s : coll) {
            System.out.println(s);
        }

    }
}
